package org.light.generator;

import java.util.ArrayList;
import java.util.List;

import org.light.core.Writeable;
import org.light.domain.Domain;
import org.light.domain.Statement;
import org.light.domain.StatementList;
import org.light.utils.StringUtil;
import org.light.utils.WriteableUtil;

public class CountNumGenerator extends Generator{

	public CountNumGenerator(){
		super();
		super.fileName = "count_num.rs";
		super.standardName = "CountNum";
	}

	@Override
	public StatementList generateStatementList() {
		List<Writeable> sList = new ArrayList<Writeable>();
		long serial = 1000L;
		sList.add(new Statement(1000L,0,"use sqlx::mysql::MySqlRow;"));
		sList.add(new Statement(2000L,0,"use sqlx::{FromRow, Row};"));
		sList.add(new Statement(3000L,0,""));
		sList.add(new Statement(4000L,0,"pub struct CountNum{"));
		sList.add(new Statement(5000L,1,"pub count_num: i64,"));
		sList.add(new Statement(6000L,0,"}"));
		sList.add(new Statement(7000L,0,""));
		sList.add(new Statement(8000L,0,"impl<'c> FromRow<'c, MySqlRow<'c>> for CountNum {"));
		sList.add(new Statement(9000L,1,"fn from_row(row: &MySqlRow) -> Result<CountNum, sqlx::Error> {"));
		sList.add(new Statement(10000L,2,"Ok(CountNum{"));
		sList.add(new Statement(11000L,3,"count_num:row.get(0),"));
		sList.add(new Statement(12000L,2,"})"));
		sList.add(new Statement(13000L,1,"}"));
		sList.add(new Statement(14000L,0,"}"));

		return WriteableUtil.merge(sList);
	}

}
